import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SqlGenTableVO, SqlGenTableForm, SqlGenTableQuery } from '@/api/srv/sqlGenTable/types';

/**
 * 查询代码生成业务2sql列表
 * @param query
 * @returns {*}
 */

export const listSqlGenTable = (query?: SqlGenTableQuery): AxiosPromise<SqlGenTableVO[]> => {
  return request({
    url: '/srv/sqlGenTable/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询代码生成业务2sql详细
 * @param id
 */
export const getSqlGenTable = (id: string | number): AxiosPromise<SqlGenTableVO> => {
  return request({
    url: '/srv/sqlGenTable/' + id,
    method: 'get'
  });
};

/**
 * 新增代码生成业务2sql
 * @param data
 */
export const addSqlGenTable = (data: SqlGenTableForm) => {
  return request({
    url: '/srv/sqlGenTable',
    method: 'post',
    data: data
  });
};

/**
 * 修改代码生成业务2sql
 * @param data
 */
export const updateSqlGenTable = (data: SqlGenTableForm) => {
  return request({
    url: '/srv/sqlGenTable',
    method: 'put',
    data: data
  });
};

/**
 * 删除代码生成业务2sql
 * @param id
 */
export const delSqlGenTable = (id: string | number | Array<string | number>) => {
  return request({
    url: '/srv/sqlGenTable/' + id,
    method: 'delete'
  });
};
